#include <string>
#include <set>
#include "ecosystem_parameters.h"
#include "Vector2D.h"
#include "EcoSystemObject.h"
#include "ecosystem_gdiplus.h"

/*
 *Entity.Inherit from DynamicEcoSystemObject.
*/
#ifndef DS_ECOSYSTEM_ENTITY
#define DS_ECOSYSTEM_ENTITY

class EcoSystem;
class FoodWeb;
class Environment;

class Entity : public DynamicEcoSystemObject
{
public:
    Entity(EcoSystem *eco_system);
    virtual ~Entity();

    //Species name.
    virtual            const unsigned int get_species_id() const = 0;

    //Entity image.
    virtual            Gdiplus::Image* get_entity_image() const = 0;

    //Create a new entity of current type.
    virtual Entity* new_entity() const = 0;

    virtual bool    is_producer() const = 0;
    virtual bool    is_consumer() const = 0;

    virtual int        get_cost_of_being_preyed() const = 0;
    virtual int        get_gain_after_being_preyed() const = 0;




    virtual Vector2D get_position() const;
    virtual Vector2D get_prev_position() const;
    virtual void set_position(Vector2D position);
    virtual double get_hp() const;
    virtual void set_hp(double hp);
    virtual double get_max_hp() const;
    virtual void set_max_hp(double max_hp);
    virtual int        get_age() const;
    virtual void    set_age(int age);
    virtual Entity *get_target() const;
    virtual void set_target(Entity *target);
    virtual void add_predator(Entity *entity);

    virtual bool is_alive() const;
    virtual void set_alive();
    virtual void set_dead();

    virtual void on_flush_memory();
protected:
    bool valid;

    //Entity that this entity is staring at.
    Entity *target;

    //Entities that are staring at this entity.
    std::set<Entity*> predators;
private:
    int age;
    double hp, max_hp;
    Vector2D position, prev_position;

};

#endif // DS_ECOSYSTEM_ENTITY
